*********************************************************
*********************************************************  
*** GBR 2024 --- JPE Revision Package *******************
*** Code for stats analyses, Study 4 ********************
*** Public (anonymized) *********************************
*********************************************************

**************************
**** Clean Data  *********
**************************

clear all
set more off

cd ".../JPEReplicationPackageDataverse/"
do GBR24CleaningStudy4.do



**************************
**** Data Preparation ****
**************************

clear all
set more off

** Load dataset from Study 4
use ".../JPEReplicationPackageDataverse/GBR24DataCleanStudy4.dta"

destring, replace



**************************
*** Text in section IV.B *
**************************

* Overall number of low-wage workers in study
count if low_unlikely==1 | low_likely==1
* Number of low-wage workers per treatment
count if low_unlikely==1
count if low_likely==1
* Summarize mean standardized labor supply in DiscrLikely scheme (it is zero
* in DiscUnlikely scheme by construction)
sum sd_l if low_likely==1
* Rank-based Mann-Whitney one-sided test on difference in labor supply between
* the two schemes (one-sided p-value is denoted by r(p_u); 0.06794061)
ranksum l, by(low_likely)
di r(p_u)
* Percentage of workers providing minimum and maximum labor supply (0 and 85, 
* 4.13% and 4.44%)
tab l 
** Not in text: mean duration and mean payment
sum Durationinminutes
gen pay=(0.05*l+0.05+0.85)
sum pay



**************************
*** Figure in main text **
**************************

** Figure 5: Mean Standardized Labor Supply per Scheme in Study 4
graph bar (mean) sd_l, over(lowwage_category, gap(*4) ///
relabel(1 "DiscrUnlikely" 2 "DiscrLikely")) ///
yscale(range(-0.25(0.05)0.25)) ylabel(-0.25(0.05)0.25, angle(0) glcolor(black*0.2)) exclude0 ytitle(Mean Standardized Labor Supply) /// 
asyvars legend(position(4) ring(0)) graphregion(color(white)) ///
 outergap(*18) bargap(40) ///
bar(1, bcolor(177 177 254) blcolor(gs4) blwidth(medium)) ///
bar(2, bcolor(55 55 255) blcolor(gs4) blwidth(medium))
graph export ".../JPEReplicationPackageDataverse/Figures/GBR24_Figure5.eps", as(eps) replace
* Note to Figure 5:
count if low_unlikely==1
count if low_likely==1
